package com.lzy.canal.component.consumer.mysql;

import com.alibaba.otter.canal.protocol.CanalEntry;
import com.lzy.canal.component.result.mysql.DefaultConsumerDdlRestData;
import com.lzy.canal.component.row.CanalRow;
import lombok.extern.slf4j.Slf4j;

import java.util.Collections;
import java.util.List;

/**
 * ddl数据转换器
 *
 */
@Slf4j
public class DefaultDdlConsumer implements DdlConsumer {

    @Override
    public List<DefaultConsumerDdlRestData> consumer(CanalRow row) {
        CanalEntry.RowChange rowChage = getRowChage(row);
        log.info("ddl数据对象操作类型:{}", rowChage.getEventType());
        log.info("ddl数据对象操作语句:{}", rowChage.getSql());
        return Collections.singletonList(new DefaultConsumerDdlRestData(rowChage.getEventType()));
    }

}
